<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 * $Log$
 *
 */
set_time_limit(0);
include($_SERVER["DOCUMENT_ROOT"]."/getvars.inc.php");
include($_SERVER["DOCUMENT_ROOT"]."/common/AllWeb.inc.php");
include($_SERVER["DOCUMENT_ROOT"]."/modules/Utility.lib.php");
global $_intLang;
$_intLang = 1;

$intLID = (int)$_data["LottoID"];
if(empty($intLID))$intLID = 1;

$arrWeb = array();
foreach($_arrWeb as $key => $arrV){
	if($arrV[3] == "")continue;
	$arrD = array();
	for($i = 0; $i < strlen($arrV[1]); $i++){
		if(bin2hex(substr($arrV[1], $i, 1)) >= '80'){
			$i++;
			$arrD[$i] = substr($arrV[1], $i - 1, 2);
		}else{
			$arrD[$i] = substr($arrV[1], $i, 1);
		}
		if(strlen($arrD[$i]) > 1)$arrD[$i] = urlencode($arrD[$i]);
	}
	$strD = implode("", $arrD);
	$strD = str_replace(",", "，", $strD);
	$arrWeb[] = $arrV[0]."@".$strD."@".$arrV[3];
}


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://192.168.5.21/crontab/getOnOff.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "AllWeb=".implode(",", $arrWeb)."&LottoID=".$intLID);
//print "AllWeb=".join(",", $arrWeb);
$ret = curl_exec ($ch);
curl_close ($ch);

print $ret;
?>